﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manage/MainPage.master" AutoEventWireup="true" CodeFile="TasksManage.aspx.cs" Inherits="Manage_SystemTasksManage" %>
<%@ Import Namespace="Shopping.Common" %>
<%@ Import Namespace="Shopping.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
<script type="text/javascript" src="/Manage/Js/TasksManage.js"></script>
<script type="text/javascript">
 var ModelOfTask = <%=new Tasks().ToJsonString() %>;
</script>


<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td colspan="8" align="left" class="HeadTitle">&gt;&gt;任务管理 &nbsp;&nbsp;&nbsp;[<a href="javascript:RunAll();" class="red bold">->运行全部任务</a>]</td>
  </tr>
  <tr class="TableHeadRow">
    <td width="60" align="center">序号</td>
    <td align="left">任务名称</td>
    <td align="left">模板页地址</td>
    <td align="left">目标页地址</td>
    <td width="60" align="center">执行状态</td>
    <td align="center">上次执行时间</td>
    <td width="120" align="center">创建日期</td>
    <td width="150" align="center">管理 [<a onclick="Add();" href="javascript:void(0);" class="red">+添加任务</a>]</td>
  </tr>

  <%
      if (listOfData != null)
      {
          for (int i = 0; i < listOfData.Count; ++i)
          {
              TaskInfo data = listOfData[i];
   %>
  <tr  onmouseover="this.style.backgroundColor='#F2F2F2';" onmouseout="this.style.backgroundColor='#FFFFFF';">
    <td align="center"><%=i+1 %>.</td>
    <td align="left"><a href="javascript:void(0);" onclick="Edit(<%=data.Task.TaskID%>);" ><%=data.Task.TaskName%> (ID=<%=data.Task.TaskID%>)</a>
      
    [ <a href="javascript:void(0);"  onclick="Run(<%=data.Task.TaskID%>);" class="green bold">运行</a> ]    </td>
    <td align="left"><a href="/Templates/<%=data.Task.TemplateUrl %>" target="_blank" title="查看模板页">/Templates/<%=data.Task.TemplateUrl %></a></td>
    <td align="left"><a href="/AutoGenerate/<%=data.Task.TargetUrl %>" target="_blank" title="查看生成的目标页">/AutoGenerate/<%=data.Task.TargetUrl %></a></td>
    <td align="center">
    <%
        if (data.Task.LastExecuteDate == null)
            Response.Write("<span class=\"blue\">尚未执行</span>");
        else
        {
            if (data.Task.IsExecuteSuc)
                Response.Write("<span class=\"green\">成功</span>");
            else
                Response.Write("<span class=\"red\">失败</span>");
        }           
    %>    </td>
    <td align="center">
    <%
        if (data.Task.LastExecuteDate == null)
            Response.Write("--");
        else
            Response.Write(data.Task.LastExecuteDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
               %>    </td>
    <td align="center"><%=data.Task.CreateDate.ToString("yyyy-MM-dd HH:mm:ss")%></td>
    <td align="center">[ <a href="javascript:void(0);"  onclick="Run(<%=data.Task.TaskID%>);" class="green bold">运行</a> ][ <a href="javascript:void(0);" onclick="Edit(<%=data.Task.TaskID%>);" >编辑</a> ][ <a href="javascript:void(0);" onclick="Delete(<%=data.Task.TaskID%>);" class="red">删除</a> ] </td>
  </tr>

   <%  }
   %>
     <tr  >
    <td colspan="8" align="center"><input name="btnRunAll" type="button" id="btnRunAll" value="运行全部任务"  class="btn2" onclick="RunAll();"/></td>
    </tr>
   <%
      }
      else
      { %>
  <tr>
    <td colspan="8" align="center">[ <span class="red bold">系统未找到任何任务信息!</span> ]</td>
    </tr>
    <% } %>
</table>

</asp:Content>

